<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateTableOpenShopMission extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_site_mission', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger('missionId')->default(0)->comment('任务序号');
            $table->unsignedTinyInteger('missionType')->default(0)->comment('任务工作类型, 1-审批 2-协办');
            $table->unsignedTinyInteger('mainStep')->default(0)->comment('任务所属阶段 主表step');
            $table->unsignedTinyInteger('stepStatus')->default(0)->comment('任务所属阶段状态 1商家待支付 2商家待签署 3开发待指派 4选址待提交 5商家待确认');
            $table->string('missionName', 64)->default('')->comment('任务名称');
            $table->unsignedTinyInteger('status')->default(1)->comment('任务状态 1 未处理 2 已处理 ');
            $table->string('orderNo', 60)->index('orderNo')->default(0)->comment('通知相关的订单编号');
            $table->unsignedInteger('dealUid')->default(0)->comment('处理人');
            $table->unsignedTinyInteger('handlerType')->default(1)->comment('任务处理人类型 1内部员工 2商家');
            $table->unsignedInteger('expiredAt')->default(0)->comment('截止时间');
            $table->unsignedInteger('completeAt')->default(0)->comment('完成时间');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '招商加盟 - 任务';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_site_mission');
    }
}
